package com.milk.controller.admin;

import com.milk.entity.Orders;
import com.milk.result.Result;
import com.milk.service.WorkspaceService;
import com.milk.vo.BusinessDataVO;
import com.milk.vo.OrderOverViewVO;
import com.milk.vo.StatusOverViewVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

@RestController
@RequestMapping("/admin/workspace")
@CrossOrigin
public class WorkspaceController {

    @Autowired
    private WorkspaceService workspaceService;

    /**
     * 查询今日运营数据
     * @return
     */
    @GetMapping("/businessData")
    @ApiOperation("查询今日运营数据")
    public Result<BusinessDataVO> businessData(){
        BusinessDataVO vo = workspaceService.businessData(LocalDate.now(),LocalDate.now());
        return Result.success(vo);
    }


    /**
     * 查询订单管理数据
     * @return
     */
    @GetMapping("/overviewOrders")
    public Result<OrderOverViewVO> overviewOrders(){
        OrderOverViewVO vo = workspaceService.overviewOrders();
        return Result.success(vo);
    }

    /**
     * 查询奶茶总览
     * @return
     */
    @GetMapping("/overviewMilktea")
    @ApiOperation("查询奶茶总览")
    public Result<StatusOverViewVO> overviewMilktea(){
        StatusOverViewVO vo = workspaceService.overviewMilktea();
        return Result.success(vo);
    }

    /**
     * 查询分类总览
     * @return
     */
    @GetMapping("/overviewCategory")
    @ApiOperation("查询分类总览")
    public Result<StatusOverViewVO> overviewCategory(){
        StatusOverViewVO vo = workspaceService.overviewCategory();
        return Result.success(vo);
    }

}
